package com.liuzh.deviceinfo.view;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.util.AttributeSet;
import android.view.View;
import b.m.a.a.b;
import c.h.a.m0.h;
import c.h.a.n0.f;
import com.pgl.sys.ces.out.ISdkLite;

public class StarAnimView extends View {
    public Paint a;
    public int b;
    public int c;
    public int d;
    public ValueAnimator e;
    public final int f = h.t(6.0f, getResources().getDisplayMetrics());
    public final int g = h.t(4.0f, getResources().getDisplayMetrics());
    public int h;
    public int i;

    public class a extends AnimatorListenerAdapter {
        public void onAnimationEnd(Animator animator) {
            StarAnimView starAnimView = StarAnimView.this;
            starAnimView.c = 0;
            starAnimView.d = 0;
            starAnimView.invalidate();
        }

        public void onAnimationStart(Animator animator) {
            StarAnimView starAnimView = StarAnimView.this;
            starAnimView.c = ISdkLite.REGION_UNSET;
            starAnimView.d = ISdkLite.REGION_UNSET;
        }
    }

    public StarAnimView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        Paint paint = new Paint(1);
        this.a = paint;
        paint.setColor(getResources().getColor(2131099707));
        this.a.setStrokeCap(Cap.ROUND);
    }

    public void a() {
        ValueAnimator ofInt = ValueAnimator.ofInt(new int[]{0, (int) ((((float) getMeasuredHeight()) * 6.0f) / 7.0f)});
        this.e = ofInt;
        ofInt.addUpdateListener(new f(this));
        this.e.addListener(new a());
        this.e.setDuration(1800);
        this.e.setInterpolator(new b());
        this.e.start();
    }

    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        int i = this.i + this.b;
        int i2 = this.f + i;
        for (int i3 = 0; i3 < 8; i3++) {
            canvas.save();
            canvas.rotate(((float) i3) * 45.0f, (float) this.h, (float) this.i);
            this.a.setStrokeWidth((float) this.g);
            this.a.setAlpha(this.d);
            canvas.drawPoint((float) this.h, (float) i, this.a);
            canvas.rotate(-9.0f, (float) this.h, (float) this.i);
            this.a.setStrokeWidth((float) this.f);
            this.a.setAlpha(this.c);
            canvas.drawPoint((float) this.h, (float) i2, this.a);
            canvas.restore();
        }
    }

    public void onSizeChanged(int i, int i2, int i3, int i4) {
        super.onSizeChanged(i, i2, i3, i4);
        this.h = i / 2;
        this.i = i2 / 2;
    }
}
